#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Time      :2021/11/10 13:21
# @Author    :cjw
from use_custom_web.base.base_page import BasePage
from use_custom_web.util.file_operator import YmlOperator
from use_custom_web.setting import ELEMENT_YML
from use_custom_web.util.log import logging


class AddCalendarPage(BasePage):
	"""新增日历页面"""

	BasePage._locators.update(YmlOperator(ELEMENT_YML['acp']).data)

	def add_calendar(self, name: str, describe: str):
		"""
		新增日历
		:param name: 日历名称
		:param describe: 日历描述
		:return:
		"""
		from use_custom_web.page.calendar_page import CalendarPage

		logging.info(f'新增日历，名称：{name}, 描述：{describe}')
		self.calendar_name.send_keys(name)
		self.calendar_describe.send_keys(describe)
		self.button_create.click()
		return CalendarPage(self.driver)
